<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<title>JavaScript的String对象</title>
	</head>
	<body>
		<h2>基本类型  number string boolean undefined null</h2>
		<h2>引用类型 Object Array String Number Boolean</h2>
		
		<script type="text/javascript">
			var s="abc";//s 基本类型  string
			var s2=new String("abc"); //s2引用类型
			document.write(typeof(s));
			document.write("<br/>");
			document.write(typeof(s2));
			document.write("<br/>");
			//instancof 判断对象是否是某种类型
			document.write(s2 instanceof String);
			document.write("<br/>");
			document.write(s instanceof String);
			document.write("<br/>");
			document.write(s==s2);
			document.write("<br/>");
			document.write(s===s2);
			document.write("<br/>");
			document.write("字符串的长度:"+s.length);
			document.write("<br/>");
			document.write("charAt():"+s2.charAt(2));
			document.write("<br/>");
			var say="java是世界上最好的语言";
			var sub=say.substr(0,4);
			document.write(sub);
			var sub2=say.substring(5,7);
			document.write("<br/>");
			document.write(sub2);
			
			document.write("<br/>");
			document.write(s2.toString());
			document.write("<br/>");
			document.write(s2.valueOf());
			document.write("<br/>");
			document.write(s2.toString()===s2.valueOf());
			document.write("<br/>");
			document.write(s===s2.valueOf());
			
			
			var n=100;
			var n2=new Number(n);
			document.write("<br/>");
			document.write(n==n2);
			document.write("<br/>");
			document.write(n===n2);
			document.write("<br/>");
			var b=true;
			var b2=new Boolean(b);
			document.write(b===b2);
		</script>
		
	</body>
</html>
